package com.study.service.Impl;

import com.study.entity.Information;
import com.study.mapper.InformationMapper;
import com.study.service.InformationService;
import com.study.vo.InformationVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class InformationServiceImpl implements InformationService {

    @Autowired
    InformationMapper informationMapper;

    /**
     * 获取所有资讯信息
     *
     * @return
     */
    @Override
    public InformationVO getInformationList() {
        Map<String, Object> map = new HashMap();

        map.put("type", "0");
        List<Information> InformationBannerList = informationMapper.getListByMap(map);

        map.put("type", "1");
        List<Information> InformationList = informationMapper.getListByMap(map);

        InformationVO informationVO = InformationVO.builder()
                .InformationBannerList(InformationBannerList)
                .InformationList(InformationList)
                .build();

        return informationVO;
    }
}
